package com.parking.order.config;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * RabbitMQ延迟消息队列配置类
 * */
@Component
public class RabbitMQConfig {
    /**
     * 订单支付延迟队列
     * */
    @Bean
    public Queue delayOrderQueue(){
        Map<String,Object> params = new HashMap<>();
        params.put("x-message-ttl", 2 * 60 * 1000);
        params.put("x-dead-letter-exchange", "delay");
        params.put("x-dead-letter-routing-key", "order2");
        return new Queue("order1", true, false, false, params);
    }
}